package com.example.drainage.ui.shadow

import android.graphics.Color
import android.os.Bundle
import com.example.arm.base.BaseActivity
import com.example.arm.ext.dp
import com.example.arm.ext.dpInt
import com.example.drainage.databinding.ActivityShadowBinding

/**
 * @author 创建人 ：yanghaozhang
 * @version 1.0
 * @package 包名 ：com.example.drainage.ui.shadow
 * @createTime 创建时间 ：2021/11/24
 * @modifyBy 修改人 ：
 * @modifyTime 修改时间 ：
 * @modifyMemo 修改备注：
 */
class ShadowActivity : BaseActivity<ActivityShadowBinding>() {
    override fun initView(savedInstanceState: Bundle?): ActivityShadowBinding =
        ActivityShadowBinding.inflate(layoutInflater)

    override fun initData(savedInstanceState: Bundle?) {
        binding.shadowView0.setShadow {
            shadowAffectRadius = 5.dp
            shadowColor = Color.BLUE
            shapeSolidColor = Color.RED
        }
        binding.shadowView1.setShadow {
            shadowAffectRadius = 15.dp
            shadowColor = Color.parseColor("#ee969696")
            shapeSolidColor = Color.WHITE
            shadowDx = 10f
            shadowDy = 10f
            shapeCornerRadius = 10.dpInt
        }
        binding.shadowView2.setShadow {
            shadowAffectRadius = 15.dp
            shadowMarginRight = 0
            shadowColor = Color.parseColor("#ee969696")
            shapeSolidColor = Color.WHITE
            shapeCornerRadiusTL = 10.dpInt
            shapeCornerRadiusBL = 10.dpInt
        }

        binding.llView.setShadow(true) {
            shadowAffectRadius = 5.dp
            shadowMargin = 8.dpInt
            shapeCornerRadius = 5.dpInt
            shadowColor = Color.RED
            shapeSolidColor = Color.YELLOW
        }

        binding.llView2.setShadow(true) {
            shadowAffectRadius = 5.dp
            shadowMargin = 7.dpInt
            shadowMarginLeft = 0
            shapeCornerRadiusTR = 5.dpInt
            shapeCornerRadiusBR = 5.dpInt
            shadowColor = Color.RED
            shapeSolidColor = Color.YELLOW
        }

        binding.llView3.setShadow {
            shadowAffectRadius = 15.dp
            shadowDx = 15.dp
            shadowDy = 3.dp
            shapeCornerRadiusTR = 5.dpInt
            shapeCornerRadiusBL = 5.dpInt
            shapeCornerRadiusTL = 20.dpInt
            shapeCornerRadiusBR = 20.dpInt
            shadowColor = Color.parseColor("#f44336")
            shapeSolidColor = Color.YELLOW
        }

        binding.llView4.setShadow(true) {
            shadowAffectRadius = 15.dp
            shadowDx = 15.dp
            shadowDy = 15.dp
            shapeCornerRadiusTR = 5.dpInt
            shapeCornerRadiusBL = 5.dpInt
            shapeCornerRadiusTL = 20.dpInt
            shapeCornerRadiusBR = 20.dpInt
            shadowColor = Color.parseColor("#f44336")
            shapeSolidColor = Color.YELLOW
            shapeStrokeColor = Color.parseColor("#03a9f4")
            shapeStrokeWidth = 3.dpInt
        }

        binding.llView5.setShadow(true) {
            shadowAffectRadius = 15.dp
            shadowDx = (-15).dp
            shadowDy = 15.dp
            shapeCornerRadiusTR = 5.dpInt
            shapeCornerRadiusBL = 5.dpInt
            shapeCornerRadiusTL = 20.dpInt
            shapeCornerRadiusBR = 20.dpInt
            shadowColor = Color.parseColor("#f44336")
            shapeSolidColor = Color.YELLOW
            shapeStrokeColor = Color.parseColor("#03a9f4")
            shapeStrokeWidth = 3.dpInt
        }

        binding.llView6.setShadow(true) {
            shadowMargin = 30.dpInt
            shadowDx = (-15).dp
            shadowDy = 15.dp
            shapeCornerRadiusTR = 5.dpInt
            shapeCornerRadiusBL = 5.dpInt
            shapeCornerRadiusTL = 20.dpInt
            shapeCornerRadiusBR = 20.dpInt
            shadowColor = Color.parseColor("#f44336")
            shapeSolidColor = Color.YELLOW
            shapeStrokeColor = Color.parseColor("#03a9f4")
            shapeStrokeWidth = 3.dpInt
        }

        binding.llView7.setShadow(true) {
            shadowAffectRadius = 30.dp
            shadowMarginLeft = 20.dpInt
            shadowMarginRight = 20.dpInt
            shapeCornerRadiusTR = 5.dpInt
            shapeCornerRadiusBL = 5.dpInt
            shapeCornerRadiusTL = 20.dpInt
            shapeCornerRadiusBR = 20.dpInt
            shadowColor = Color.parseColor("#f44336")
            shapeSolidColor = Color.YELLOW
            shapeStrokeColor = Color.parseColor("#03a9f4")
            shapeStrokeWidth = 3.dpInt
        }
    }
}